﻿@model PagedList.IPagedList<Doan.Forum.Models.Topic>
@using System.Globalization
@using PagedList; 
@foreach (var item in Model)
{
    Html.RenderAction("ShowTopic", "Share", new { id = item.TopicId });
}
<script>
    $(document).ready(function () {
        var page = @ViewBag.pageNumber;
        var id = "cmpage" + page;
        $(".pagingbar a").removeClass("cmpageActive");
        $('#' + id).addClass('cmpageActive');
    });
</script>

<div class="pagingbar">
    @Ajax.ActionLink("Đầu", "SearchbyTagPartial", new { page = 1 }, new AjaxOptions { UpdateTargetId = "searchResult" })
    @Ajax.ActionLink("<", "SearchbyTagPartial", new { page = Model.PageNumber - 1 }, new AjaxOptions { UpdateTargetId = "searchResult" })
    @for (int i = 1; i <= Model.PageCount; i++)
    {
        var page = i.ToString(CultureInfo.InvariantCulture);
        @Ajax.ActionLink(page, "SearchbyTagPartial", new { page = i }, new AjaxOptions { UpdateTargetId = "searchResult" }, new { @id = "cmpage" + page })
    }
    @Ajax.ActionLink(">", "SearchbyTagPartial", new { page = Model.PageNumber + 1 }, new AjaxOptions { UpdateTargetId = "searchResult" })
    @Ajax.ActionLink("Cuối", "SearchbyTagPartial", new { page = Model.PageCount }, new AjaxOptions { UpdateTargetId = "searchResult" })
</div>